import App from './App'

// #ifndef VUE3
import Vue from 'vue'
import './uni.promisify.adaptor'
//懒加载
import store from 'store'
Vue.prototype.$store = store

Vue.config.productionTip = false
//懒加载

import VueLazyload from 'vue-lazyload'
Vue.use(VueLazyload,
    {preLoad: 1.3, //预加载的宽高比loading: 
    loadimage:"./static/img/loding.jpg", //图片加载状态下显示的图片
    // error: "", //图片加载失败时显示的图片
    attempt: 1, // 加载错误后最大尝试次数
})
// Vue 指令
Vue.directive('page-height', {
inserted: function (el) {
	let windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
	el.style.height = windowHeight + 'px';
}
});
//权限跳转:
Vue.prototype.navigateTo = (options)=>{
	// 判断是否登录
	if(! store.state.user.loginStatus){
		uni.showToast({
			title:"请先登录",
			icon:"none",
			mask:true,
			duration:1500
		})
		//自动跳转到登录页面
		return uni.navigateTo({
			url:'/pages/logn/logn'
		})
	}
	uni.navigateTo(options)
}

App.mpType = 'app'


const app = new Vue({
	store,
  ...App
})
app.$mount()
// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'
export function createApp() {
  const app = createSSRApp(App)
  return {
    app
  }
}
// #endif